//
//  CYMyCommentTableViewCell.m
//  cyydt
//
//  Created by chu on 2019/2/1.
//  Copyright © 2019 chu. All rights reserved.
//

#import "CYMyCommentTableViewCell.h"

@implementation CYMyCommentTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


- (void)setModel:(CYProjectModel *)model{
    _model = model;
    
    
    self.titleLabel.text = model.commentContent;
    self.bottomImageView.hidden = YES;
    self.bottomImageViewWidthConstraint.constant = 0;
    if ([NSString stringIsNull:model.img]) {
        self.upImageViewWidthConstraint.constant = 0;
        self.bottomImageViewWidthConstraint.constant = 0;
    }else{
        self.bottomImageViewWidthConstraint.constant = 50;
        self.upImageViewWidthConstraint.constant = 50;
        [self.upImageView sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"wd_gezl_lj"] completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
            self.bottomImageView.hidden = NO;
        }];
    }
    if ([model.type isEqualToString:@"3"]) {
        //项目
        self.bottomImageView.hidden = YES;
        self.bottomImageViewWidthConstraint.constant = 0;
    }else if ([model.type isEqualToString:@"4"]){
        //问答
        self.bottomImageView.hidden = YES;
        self.bottomImageViewWidthConstraint.constant = 0;
    }else if ([model.type isEqualToString:@"7"]){
        //文章
        self.bottomImageView.hidden = YES;
        self.bottomImageViewWidthConstraint.constant = 0;
    }else if ([model.type isEqualToString:@"28"]){
        //视频
        self.bottomImageView.hidden = NO;
        self.bottomImageViewWidthConstraint.constant = 50;
        
    }
    self.contentLabel.text = model.title;
    self.timeLabel.text = model.createTime;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
